<template>
  <div>
    <HomePannel ref="target" title="新鲜好物" sub-title="新鲜出炉 品质靠谱">
      <!-- 面板组件测试 -->
      <template #right>
        <XtxMore path="/" />
      </template>
      <HomeComponent :list="newData" />
      <!-- <ul ref="pannel" class="goods-list">
      <li v-for="item in newData" :key="item.id">
        <RouterLink to="/">
          <img :src="item.picture" alt="" />
          <p class="name">{{ item.name }}</p>
          <p class="price">&yen;{{ item.price }}</p>
        </RouterLink>
      </li>
    </ul> -->
    </HomePannel>
  </div>
</template>

<script>
import { findNew } from '@/api/home'
import HomePannel from './home-panel.vue'
import { ref } from 'vue'
import HomeComponent from './home-component'
import { useObserve } from '@/hook'
export default {
  components: {
    HomePannel,
    HomeComponent
  },
  setup () {
    const newData = ref([])
    async function getNew () {
      const res = await findNew()
      newData.value = res.result
    }
    const { target } = useObserve(getNew)
    // onMounted(() => {
    //   getNew()
    // }
    // )
    return { newData, target }
  }

}
</script>

<style lang="less" scoped>
</style>
